export default [
  {
    name: "普通数学运算模块",
    children: [
      {
        name: "常数",
        description: "这是一个常数节点，out = value",
        type: "model.constant",
        selected: false,
        initParams: [
          {
            paramName: "value",
            paramType: "number|array[number]",
            paramRes: 1,
            display: {
              type: "input",
            },
          },
        ],
        inArr: [],
        outArr: [{ paramName: "out", paramType: "number|array[number]" }],
      },
      {
        name: "+",
        description: "这是一个简单的加法模块，sum = x1 + x2.",
        type: "model.add",
        selected: false,
        initParams: [],
        inArr: [
          { paramName: "x1", paramType: "number" },
          { paramName: "x2", paramType: "number" },
        ],
        outArr: [{ paramName: "sum", paramType: "number" }],
      },
      {
        name: "-",
        description: "这是一个简单的减法模块，bias = x1 - x2.",
        type: "model.subtract",
        selected: false,
        initParams: [],
        inArr: [
          { paramName: "x1", paramType: "number" },
          { paramName: "x2", paramType: "number" },
        ],
        outArr: [{ paramName: "bias", paramType: "number" }],
      },
      {
        name: "×",
        description: "这是一个简单的乘法法模块，mul = x1 × x2.",
        type: "model.multiply",
        selected: false,
        initParams: [],
        inArr: [
          { paramName: "x1", paramType: "number" },
          { paramName: "x2", paramType: "number" },
        ],
        outArr: [{ paramName: "mul", paramType: "number" }],
      },
      {
        name: "÷",
        description: "这是一个简单的减法模块，div = x1 ÷ x2.",
        type: "model.divide",
        selected: false,
        initParams: [],
        inArr: [
          { paramName: "x1", paramType: "number" },
          { paramName: "x2", paramType: "number" },
        ],
        outArr: [{ paramName: "div", paramType: "number" }],
      },
      {
        name: "π",
        description: "常数π",
        type: "model.pi",
        selected: false,
        initParams: [],
        inArr: [],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "sin x",
        description: "正弦运算节点，out = sin(x)",
        type: "model.sin",
        initParams: [],
        inArr: [{ paramName: "x", paramType: "number" }],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "cos x",
        description: "余弦运算节点，out = cos(x)",
        type: "model.cos",
        initParams: [],
        inArr: [{ paramName: "x", paramType: "number" }],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "tan x",
        description: "正切运算节点，out = tan(x)",
        type: "model.tan",
        initParams: [],
        inArr: [{ paramName: "x", paramType: "number" }],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "e(自然常数)",
        description: "自然常数e",
        type: "model.e",
        selected: false,
        initParams: [],
        inArr: [],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "exp x",
        description: "指数运算节点，out = e^x",
        type: "model.exp",
        initParams: [],
        inArr: [{ paramName: "x", paramType: "number" }],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "ln x",
        description: "对数运算节点，out = ln(x)",
        type: "model.ln",
        initParams: [],
        inArr: [{ paramName: "x", paramType: "number" }],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "pow x",
        description: "次方运算节点，out = base^x",
        type: "model.pow",
        initParams: [],
        inArr: [
          { paramName: "base", paramType: "number" },
          { paramName: "x", paramType: "number" },
        ],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "log x",
        description:
          "对数运算节点，返回以 base 为底 x 的对数， out = log_base(x)",
        type: "model.log",
        inArr: [
          { paramName: "base", paramType: "number" },
          { paramName: "x", paramType: "number" },
        ],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
    ],
  },
  {
    name: "复杂数学运算模块",
    children: [
      {
        name: "Func",
        description:
          "函数节点，可以使用它来构建一个函数，类似于子系统Subsystem，不过函数节点只能作为一个单输入单输出的节点，函数默认为 y = x。如果是多输入多输出节点，推荐使用子系统Subsystem节点。",
        type: "model.func",
        selected: false,
        initParams: [],
        inArr: [{ paramName: "x", paramType: "any" }],
        outArr: [{ paramName: "y", paramType: "any" }],
        hasFunc: true,
        func: [],
      },
      {
        name: "RK4",
        description: "四阶龙格库塔结算节点",
        type: "model.rk4",
        selected: false,
        initParams: [],
        inArr: [
          { paramName: "cur_s", paramType: "number|array" },
          { paramName: "step", paramType: "number" },
        ],
        outArr: [{ paramName: "next_s", paramType: "number|array" }],
        hasFunc: true,
        func: [],
      },
    ],
  },
  {
    name: "控制模块",
    children: [
      {
        name: "Default",
        description:
          "默认参数节点，用于为循环的点提供默认参数，用于启动第一次循环，使用类似 Constant 节点",
        type: "model.default",
        selected: false,
        initParams: [
          {
            paramName: "value",
            paramType: "number|array[number]",
            paramRes: 1,
            display: {
              type: "input",
            },
          },
        ],
        inArr: [],
        outArr: [{ paramName: "out", paramType: "number|array[number]" }],
      },
      {
        name: "Condition",
        description: "条件判断节点，当判断条件成功时，后续节点才会被执行",
        type: "model.condition",
        selected: false,
        initParams: [
          {
            paramName: "cond",
            paramType: "string",
            paramRes: "gt",
            display: {
              type: "select",
              options: [
                {
                  label: ">",
                  value: "gt",
                },
                {
                  label: "<",
                  value: "lt",
                },
                {
                  label: "=",
                  value: "eq",
                },
                {
                  label: ">=",
                  value: "ge",
                },
                {
                  label: "<=",
                  value: "le",
                },
              ],
            },
          },
          {
            paramName: "compVal",
            paramType: "number",
            paramRes: 1,
            display: {
              type: "input",
            },
          },
        ],
        inArr: [{ paramName: "val", paramType: "number" }],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
      {
        name: "Switch",
        description:
          "开关节点，如果开关的判断条件 cond 为 true，则返回 if_true 端口的值，否则返回 if_false 端口的值",
        type: "model.switch",
        selected: "model.switch",
        initParams: [
          {
            paramName: "cond",
            paramType: "string",
            paramRes: "gt",
            display: {
              type: "select",
              options: [
                {
                  label: ">",
                  value: "gt",
                },
                {
                  label: "<",
                  value: "lt",
                },
                {
                  label: "=",
                  value: "eq",
                },
                {
                  label: ">=",
                  value: "ge",
                },
                {
                  label: "<=",
                  value: "le",
                },
              ],
            },
          },
          {
            paramName: "compVal",
            paramType: "number",
            paramRes: 1,
            display: {
              type: "input",
            },
          },
        ],
        inArr: [
          { paramName: "if_true", paramType: "any" },
          { paramName: "cond", paramType: "any" },
          { paramName: "if_false", paramType: "any" },
        ],
        outArr: [{ paramName: "out", paramType: "number" }],
      },
    ],
  },
  {
    name: "子系统模块",
    children: [
      {
        name: "in",
        description: "输入端口",
        type: "port.in",
        selected: false,
        initParams: [],
        inArr: [],
        outArr: [{ paramName: "out", paramType: "any" }],
      },
      {
        name: "out",
        description: "输出端口",
        type: "port.out",
        selected: false,
        initParams: [],
        inArr: [{ paramName: "in", paramType: "any" }],
        outArr: [],
      },
      {
        name: "Subsystem",
        description: "构造子系统的节点，可以在子系统内构建一套逻辑流程",
        type: "subsystem.system",
        selected: false,
        initParams: [],
        inArr: [],
        outArr: [],
        // 判断是不是 子系统 节点
        isGroup: true,
        kids: [], // 子系统的节点逻辑保存在 kids 中
      },
    ],
  },
  {
    name: "输出查看模块",
    children: [
      {
        name: "View",
        description: "查看输入的参数值",
        type: "view.view",
        selected: false,
        initParams: [],
        inArr: [{ paramName: "in", paramType: "any", paramRes: undefined }],
        outArr: [],
      },
    ],
  },
  {
    name: "绘图模块",
    children: [
      {
        name: "plot",
        description: "输入通道参数 x 和 y，绘制出对应的图像",
        type: "graph.plot",
        selected: false,
        initParams: [],
        inArr: [
          {
            paramName: "x",
            paramType: "array",
            paramRes: undefined,
          },
          {
            paramName: "y",
            paramType: "array",
            paramRes: undefined,
          },
        ],
        outArr: [],
      },
    ],
  },
  {
    name: "Mux模块",
    children: [
      {
        name: "Mux",
        description: "合并数据称为一个向量或矩阵",
        type: "mux.mux",
        selected: false,
        initParams: [
          {
            paramName: "value",
            paramType: "number",
            paramRes: 1,
            display: {
              type: "input",
            },
          },
        ],
        inArr: [
          { paramName: "1", paramType: "number|array", paramRes: undefined },
        ],
        outArr: [{ paramName: "out", paramType: "array", paramRes: undefined }],
      },
      {
        name: "Demux",
        description: "将一个向量或矩阵拆分开来",
        type: "mux.demux",
        selected: false,
        initParams: [
          {
            paramName: "value",
            paramType: "number",
            paramRes: 1,
            display: {
              type: "input",
            },
          },
        ],
        inArr: [{ paramName: "in", paramType: "array", paramRes: undefined }],
        outArr: [
          { paramName: "1", paramType: "number|array", paramRes: undefined },
          { paramName: "2", paramType: "number|array", paramRes: undefined },
          { paramName: "3", paramType: "number|array", paramRes: undefined },
          { paramName: "4", paramType: "number|array", paramRes: undefined },
        ],
      },
    ],
  },
];
